//https://leetcode.cn/problems/n-ary-tree-level-order-traversal/

class Solution {
public:
    vector<vector<int>> levelOrder(Node* root) {
        vector<vector<int>> ret;
        queue<Node*> t;
        if (root == nullptr) return ret;

        t.push(root);
        while (t.size())
        {
            int sz = t.size();
            vector<int> temp;
            for (int i = 0; i < sz; i++)
            {
                //出队列
                Node* top = t.front();
                t.pop();

                temp.push_back(top->val);

                //入队列
                for (auto node : top->children)
                {
                    if (node)
                        t.push(node);
                }
            }
            ret.push_back(temp);

        }

        return ret;

    }
};